define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_carriageList(result) {
			if(false) {
				result = '{"success": true,"msg": "","result": {"freight": ['+
				'{"id": "001","name": "普通配送","status": "申请中"},'+
				'{"id": "002","name": "普通配送","status": "申请中"}]},'+
				'"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}

		};
		function get_data_carriageDelete(result){
			if(false) {
				result = '{"success": true,"msg": "","result": {"id": "001"},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else
				return result;
		}
		//返回信息
		return {
			//运费模板一览
			carriage_list: function(nPage,callback,calldone) {
				//post请求
				Http.post({
					method: 'member.freightmode.getlist',
					pagelimit:15,
					nPage:nPage
				}, function(result) {
					//函数回调
					if(callback)
						callback(get_data_carriageList(result).result);

				}, function(e) {

				}, function() {
					if(calldone)
					calldone();
				});
			},
			//删除模板
			model_delete:function(id,callback){
				Http.post({
					method:'member.freightmode.delete',
					id:id
					
				},function(result){
					if(callback)
					callback(get_data_carriageDelete(result));
				},function(e){
					
				},function(){
					
				})
			}
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Logistics_Modal", factory);
});